<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QTableView Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QTableView Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTableView class provides a default model/view
implementation of a table view. <a href="#details">More...</a></p>

<p>Inherits <a href="qabstractitemview.html">QAbstractItemView</a>.</p><p>Inherited by <a href="qtablewidget.html">QTableWidget</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtableview.html#QTableView">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qtableview.html#clearSpans">clearSpans</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtableview.html#columnAt">columnAt</a></b> (<i>self</i>, int&#160;<i>x</i>)</li><li><div class="fn" /><b><a href="qtableview.html#columnCountChanged">columnCountChanged</a></b> (<i>self</i>, int&#160;<i>oldCount</i>, int&#160;<i>newCount</i>)</li><li><div class="fn" /><b><a href="qtableview.html#columnMoved">columnMoved</a></b> (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>oldIndex</i>, int&#160;<i>newIndex</i>)</li><li><div class="fn" /><b><a href="qtableview.html#columnResized">columnResized</a></b> (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>oldWidth</i>, int&#160;<i>newWidth</i>)</li><li><div class="fn" />int <b><a href="qtableview.html#columnSpan">columnSpan</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>column</i>)</li><li><div class="fn" />int <b><a href="qtableview.html#columnViewportPosition">columnViewportPosition</a></b> (<i>self</i>, int&#160;<i>column</i>)</li><li><div class="fn" />int <b><a href="qtableview.html#columnWidth">columnWidth</a></b> (<i>self</i>, int&#160;<i>column</i>)</li><li><div class="fn" /><b><a href="qtableview.html#currentChanged">currentChanged</a></b> (<i>self</i>, QModelIndex&#160;<i>current</i>, QModelIndex&#160;<i>previous</i>)</li><li><div class="fn" />Qt.PenStyle <b><a href="qtableview.html#gridStyle">gridStyle</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtableview.html#hideColumn">hideColumn</a></b> (<i>self</i>, int&#160;<i>column</i>)</li><li><div class="fn" /><b><a href="qtableview.html#hideRow">hideRow</a></b> (<i>self</i>, int&#160;<i>row</i>)</li><li><div class="fn" />QHeaderView <b><a href="qtableview.html#horizontalHeader">horizontalHeader</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtableview.html#horizontalOffset">horizontalOffset</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtableview.html#horizontalScrollbarAction">horizontalScrollbarAction</a></b> (<i>self</i>, int&#160;<i>action</i>)</li><li><div class="fn" />QModelIndex <b><a href="qtableview.html#indexAt">indexAt</a></b> (<i>self</i>, QPoint&#160;<i>p</i>)</li><li><div class="fn" />bool <b><a href="qtableview.html#isColumnHidden">isColumnHidden</a></b> (<i>self</i>, int&#160;<i>column</i>)</li><li><div class="fn" />bool <b><a href="qtableview.html#isCornerButtonEnabled">isCornerButtonEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtableview.html#isIndexHidden">isIndexHidden</a></b> (<i>self</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" />bool <b><a href="qtableview.html#isRowHidden">isRowHidden</a></b> (<i>self</i>, int&#160;<i>row</i>)</li><li><div class="fn" />bool <b><a href="qtableview.html#isSortingEnabled">isSortingEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />QModelIndex <b><a href="qtableview.html#moveCursor">moveCursor</a></b> (<i>self</i>, QAbstractItemView.CursorAction&#160;<i>cursorAction</i>, Qt.KeyboardModifiers&#160;<i>modifiers</i>)</li><li><div class="fn" /><b><a href="qtableview.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qtableview.html#resizeColumnsToContents">resizeColumnsToContents</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtableview.html#resizeColumnToContents">resizeColumnToContents</a></b> (<i>self</i>, int&#160;<i>column</i>)</li><li><div class="fn" /><b><a href="qtableview.html#resizeRowsToContents">resizeRowsToContents</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtableview.html#resizeRowToContents">resizeRowToContents</a></b> (<i>self</i>, int&#160;<i>row</i>)</li><li><div class="fn" />int <b><a href="qtableview.html#rowAt">rowAt</a></b> (<i>self</i>, int&#160;<i>y</i>)</li><li><div class="fn" /><b><a href="qtableview.html#rowCountChanged">rowCountChanged</a></b> (<i>self</i>, int&#160;<i>oldCount</i>, int&#160;<i>newCount</i>)</li><li><div class="fn" />int <b><a href="qtableview.html#rowHeight">rowHeight</a></b> (<i>self</i>, int&#160;<i>row</i>)</li><li><div class="fn" /><b><a href="qtableview.html#rowMoved">rowMoved</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>oldIndex</i>, int&#160;<i>newIndex</i>)</li><li><div class="fn" /><b><a href="qtableview.html#rowResized">rowResized</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>oldHeight</i>, int&#160;<i>newHeight</i>)</li><li><div class="fn" />int <b><a href="qtableview.html#rowSpan">rowSpan</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>column</i>)</li><li><div class="fn" />int <b><a href="qtableview.html#rowViewportPosition">rowViewportPosition</a></b> (<i>self</i>, int&#160;<i>row</i>)</li><li><div class="fn" /><b><a href="qtableview.html#scrollContentsBy">scrollContentsBy</a></b> (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</li><li><div class="fn" /><b><a href="qtableview.html#scrollTo">scrollTo</a></b> (<i>self</i>, QModelIndex&#160;<i>index</i>, QAbstractItemView.ScrollHint&#160;<i>hint</i>&#160;=&#160;QAbstractItemView.EnsureVisible)</li><li><div class="fn" /><b><a href="qtableview.html#selectColumn">selectColumn</a></b> (<i>self</i>, int&#160;<i>column</i>)</li><li><div class="fn" />list-of-QModelIndex <b><a href="qtableview.html#selectedIndexes">selectedIndexes</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtableview.html#selectionChanged">selectionChanged</a></b> (<i>self</i>, QItemSelection&#160;<i>selected</i>, QItemSelection&#160;<i>deselected</i>)</li><li><div class="fn" /><b><a href="qtableview.html#selectRow">selectRow</a></b> (<i>self</i>, int&#160;<i>row</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setColumnHidden">setColumnHidden</a></b> (<i>self</i>, int&#160;<i>column</i>, bool&#160;<i>hide</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setColumnWidth">setColumnWidth</a></b> (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>width</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setCornerButtonEnabled">setCornerButtonEnabled</a></b> (<i>self</i>, bool&#160;<i>enable</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setGridStyle">setGridStyle</a></b> (<i>self</i>, Qt.PenStyle&#160;<i>style</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setHorizontalHeader">setHorizontalHeader</a></b> (<i>self</i>, QHeaderView&#160;<i>header</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setModel">setModel</a></b> (<i>self</i>, QAbstractItemModel&#160;<i>model</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setRootIndex">setRootIndex</a></b> (<i>self</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setRowHeight">setRowHeight</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>height</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setRowHidden">setRowHidden</a></b> (<i>self</i>, int&#160;<i>row</i>, bool&#160;<i>hide</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setSelection">setSelection</a></b> (<i>self</i>, QRect&#160;<i>rect</i>, QItemSelectionModel.SelectionFlags&#160;<i>command</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setSelectionModel">setSelectionModel</a></b> (<i>self</i>, QItemSelectionModel&#160;<i>selectionModel</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setShowGrid">setShowGrid</a></b> (<i>self</i>, bool&#160;<i>show</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setSortingEnabled">setSortingEnabled</a></b> (<i>self</i>, bool&#160;<i>enable</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setSpan">setSpan</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, int&#160;<i>rowSpan</i>, int&#160;<i>columnSpan</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setVerticalHeader">setVerticalHeader</a></b> (<i>self</i>, QHeaderView&#160;<i>header</i>)</li><li><div class="fn" /><b><a href="qtableview.html#setWordWrap">setWordWrap</a></b> (<i>self</i>, bool&#160;<i>on</i>)</li><li><div class="fn" /><b><a href="qtableview.html#showColumn">showColumn</a></b> (<i>self</i>, int&#160;<i>column</i>)</li><li><div class="fn" />bool <b><a href="qtableview.html#showGrid">showGrid</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtableview.html#showRow">showRow</a></b> (<i>self</i>, int&#160;<i>row</i>)</li><li><div class="fn" />int <b><a href="qtableview.html#sizeHintForColumn">sizeHintForColumn</a></b> (<i>self</i>, int&#160;<i>column</i>)</li><li><div class="fn" />int <b><a href="qtableview.html#sizeHintForRow">sizeHintForRow</a></b> (<i>self</i>, int&#160;<i>row</i>)</li><li><div class="fn" /><b><a href="qtableview.html#sortByColumn">sortByColumn</a></b> (<i>self</i>, int&#160;<i>column</i>)</li><li><div class="fn" /><b><a href="qtableview.html#sortByColumn-2">sortByColumn</a></b> (<i>self</i>, int&#160;<i>column</i>, Qt.SortOrder&#160;<i>order</i>)</li><li><div class="fn" /><b><a href="qtableview.html#timerEvent">timerEvent</a></b> (<i>self</i>, QTimerEvent&#160;<i>event</i>)</li><li><div class="fn" /><b><a href="qtableview.html#updateGeometries">updateGeometries</a></b> (<i>self</i>)</li><li><div class="fn" />QHeaderView <b><a href="qtableview.html#verticalHeader">verticalHeader</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtableview.html#verticalOffset">verticalOffset</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtableview.html#verticalScrollbarAction">verticalScrollbarAction</a></b> (<i>self</i>, int&#160;<i>action</i>)</li><li><div class="fn" />QStyleOptionViewItem <b><a href="qtableview.html#viewOptions">viewOptions</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qtableview.html#visualRect">visualRect</a></b> (<i>self</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" />QRegion <b><a href="qtableview.html#visualRegionForSelection">visualRegionForSelection</a></b> (<i>self</i>, QItemSelection&#160;<i>selection</i>)</li><li><div class="fn" />bool <b><a href="qtableview.html#wordWrap">wordWrap</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTableView class provides a default model/view
implementation of a table view.</p>
<p>A QTableView implements a table view that displays items from a
model. This class is used to provide standard tables that were
previously provided by the <a href="porting4.html#qtable">QTable</a> class, but using the more
flexible approach provided by Qt's model/view architecture.</p>
<p>The QTableView class is one of the <a href="model-view.html">Model/View Classes</a> and is part of Qt's
<a href="model-view-programming.html">model/view framework</a>.</p>
<p>QTableView implements the interfaces defined by the <a href="qabstractitemview.html">QAbstractItemView</a> class to allow it to
display data provided by models derived from the <a href="qabstractitemmodel.html">QAbstractItemModel</a> class.</p>
<a id="navigation" name="navigation" />
<h3>Navigation</h3>
<p>You can navigate the cells in the table by clicking on a cell
with the mouse, or by using the arrow keys. Because QTableView
enables <a href="qabstractitemview.html#tabKeyNavigation-prop">tabKeyNavigation</a>
by default, you can also hit Tab and Backtab to move from cell to
cell.</p>
<a id="visual-appearance" name="visual-appearance" />
<h3>Visual Appearance</h3>
<p>The table has a vertical header that can be obtained using the
<a href="qtableview.html#verticalHeader">verticalHeader</a>()
function, and a horizontal header that is available through the
<a href="qtableview.html#horizontalHeader">horizontalHeader</a>()
function. The height of each row in the table can be found by using
<a href="qtableview.html#rowHeight">rowHeight</a>(); similarly, the
width of columns can be found using <a href="qtableview.html#columnWidth">columnWidth</a>(). Since both of
these are plain widgets, you can hide either of them using their
<a href="qwidget.html#hide">hide</a>() functions.</p>
<p>Rows and columns can be hidden and shown with <a href="qtableview.html#hideRow">hideRow</a>(), <a href="qtableview.html#hideColumn">hideColumn</a>(), <a href="qtableview.html#showRow">showRow</a>(), and <a href="qtableview.html#showColumn">showColumn</a>(). They can be selected
with <a href="qtableview.html#selectRow">selectRow</a>() and
<a href="qtableview.html#selectColumn">selectColumn</a>(). The
table will show a grid depending on the <a href="qtableview.html#showGrid-prop">showGrid</a> property.</p>
<p>The items shown in a table view, like those in the other item
views, are rendered and edited using standard <a href="qitemdelegate.html">delegates</a>. However, for some tasks it is
sometimes useful to be able to insert widgets in a table instead.
Widgets are set for particular indexes with the <a href="qabstractitemview.html#setIndexWidget">setIndexWidget()</a>
function, and later retrieved with <a href="qabstractitemview.html#indexWidget">indexWidget()</a>.</p>
<table class="generic">
<tr class="odd" valign="top">
<td><img src="images/qtableview-resized.png" /></td>
<td>By default, the cells in a table do not expand to fill the
available space.
<p>You can make the cells fill the available space by stretching
the last header section. Access the relevant header using <a href="qtableview.html#horizontalHeader">horizontalHeader</a>() or
<a href="qtableview.html#verticalHeader">verticalHeader</a>() and
set the header's <a href="qheaderview.html#stretchLastSection-prop">stretchLastSection</a>
property.</p>
<p>To distribute the available space according to the space
requirement of each column or row, call the view's <a href="qtableview.html#resizeColumnsToContents">resizeColumnsToContents</a>()
or <a href="qtableview.html#resizeRowsToContents">resizeRowsToContents</a>()
functions.</p>
</td>
</tr>
</table>
<a id="coordinate-systems" name="coordinate-systems" />
<h3>Coordinate Systems</h3>
<p>For some specialized forms of tables it is useful to be able to
convert between row and column indexes and widget coordinates. The
<a href="qtableview.html#rowAt">rowAt</a>() function provides the
y-coordinate within the view of the specified row; the row index
can be used to obtain a corresponding y-coordinate with <a href="qtableview.html#rowViewportPosition">rowViewportPosition</a>().
The <a href="qtableview.html#columnAt">columnAt</a>() and <a href="qtableview.html#columnViewportPosition">columnViewportPosition</a>()
functions provide the equivalent conversion operations between
x-coordinates and column indexes.</p>
<a id="styles" name="styles" />
<h3>Styles</h3>
<p>QTableView is styled appropriately for each platform. The
following images show how it looks on three different platforms. Go
to the <a href="gallery.html">Qt Widget Gallery</a> to see its
appearance in other styles.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="Screenshot of a Windows XP style table view" src="images/windowsxp-tableview.png" /></td>
<td><img alt="Screenshot of a Macintosh style table view" src="images/macintosh-tableview.png" /></td>
<td><img alt="Screenshot of a Plastique style table view" src="images/plastique-tableview.png" /></td>
</tr>
<tr class="even" valign="top">
<td>A <a href="gallery-windowsxp.html">Windows XP style</a> table
view.</td>
<td>A <a href="gallery-macintosh.html">Macintosh style</a> table
view.</td>
<td>A <a href="gallery-plastique.html">Plastique style</a> table
view.</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTableView" />QTableView.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a table view with a <i>parent</i> to represent the
data.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html">QAbstractItemModel</a>.</p>


<h3 class="fn"><a name="clearSpans" />QTableView.clearSpans (<i>self</i>)</h3><p>Removes all row and column spans in the table view.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qtableview.html#setSpan">setSpan</a>().</p>


<h3 class="fn"><a name="columnAt" />int QTableView.columnAt (<i>self</i>, int&#160;<i>x</i>)</h3><p>Returns the column in which the given x-coordinate, <i>x</i>, in
contents coordinates is located.</p>
<p><b>Note:</b> This function returns -1 if the given coordinate is
not valid (has no column).</p>
<p><b>See also</b> <a href="qtableview.html#rowAt">rowAt</a>().</p>


<h3 class="fn"><a name="columnCountChanged" />QTableView.columnCountChanged (<i>self</i>, int&#160;<i>oldCount</i>, int&#160;<i>newCount</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void columnCountChanged(int,int)</tt>.</p><p>This slot is called whenever columns are added or deleted. The
previous number of columns is specified by <i>oldCount</i>, and the
new number of columns is specified by <i>newCount</i>.</p>


<h3 class="fn"><a name="columnMoved" />QTableView.columnMoved (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>oldIndex</i>, int&#160;<i>newIndex</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void columnMoved(int,int,int)</tt>.</p><p>This slot is called to change the index of the given
<i>column</i> in the table view. The old index is specified by
<i>oldIndex</i>, and the new index by <i>newIndex</i>.</p>
<p><b>See also</b> <a href="qtableview.html#rowMoved">rowMoved</a>().</p>


<h3 class="fn"><a name="columnResized" />QTableView.columnResized (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>oldWidth</i>, int&#160;<i>newWidth</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void columnResized(int,int,int)</tt>.</p><p>This slot is called to change the width of the given
<i>column</i>. The old width is specified by <i>oldWidth</i>, and
the new width by <i>newWidth</i>.</p>
<p><b>See also</b> <a href="qtableview.html#rowResized">rowResized</a>().</p>


<h3 class="fn"><a name="columnSpan" />int QTableView.columnSpan (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>column</i>)</h3><p>Returns the column span of the table element at (<i>row</i>,
<i>column</i>). The default is 1.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qtableview.html#setSpan">setSpan</a>()
and <a href="qtableview.html#rowSpan">rowSpan</a>().</p>


<h3 class="fn"><a name="columnViewportPosition" />int QTableView.columnViewportPosition (<i>self</i>, int&#160;<i>column</i>)</h3><p>Returns the x-coordinate in contents coordinates of the given
<i>column</i>.</p>


<h3 class="fn"><a name="columnWidth" />int QTableView.columnWidth (<i>self</i>, int&#160;<i>column</i>)</h3><p>Returns the width of the given <i>column</i>.</p>
<p><b>See also</b> <a href="qtableview.html#setColumnWidth">setColumnWidth</a>(), <a href="qtableview.html#resizeColumnToContents">resizeColumnToContents</a>(),
and <a href="qtableview.html#rowHeight">rowHeight</a>().</p>


<h3 class="fn"><a name="currentChanged" />QTableView.currentChanged (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>current</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>previous</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#currentChanged">QAbstractItemView.currentChanged</a>().</p>


<h3 class="fn"><a name="gridStyle" /><a href="qt.html#PenStyle-enum">Qt.PenStyle</a> QTableView.gridStyle (<i>self</i>)</h3><h3 class="fn"><a name="hideColumn" />QTableView.hideColumn (<i>self</i>, int&#160;<i>column</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void hideColumn(int)</tt>.</p><p>Hide the given <i>column</i>.</p>
<p><b>See also</b> <a href="qtableview.html#showColumn">showColumn</a>() and <a href="qtableview.html#hideRow">hideRow</a>().</p>


<h3 class="fn"><a name="hideRow" />QTableView.hideRow (<i>self</i>, int&#160;<i>row</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void hideRow(int)</tt>.</p><p>Hide the given <i>row</i>.</p>
<p><b>See also</b> <a href="qtableview.html#showRow">showRow</a>()
and <a href="qtableview.html#hideColumn">hideColumn</a>().</p>


<h3 class="fn"><a name="horizontalHeader" /><a href="qheaderview.html">QHeaderView</a> QTableView.horizontalHeader (<i>self</i>)</h3><p>Returns the table view's horizontal header.</p>
<p><b>See also</b> <a href="qtableview.html#setHorizontalHeader">setHorizontalHeader</a>(),
<a href="qtableview.html#verticalHeader">verticalHeader</a>(), and
<a href="qabstractitemmodel.html#headerData">QAbstractItemModel.headerData</a>().</p>


<h3 class="fn"><a name="horizontalOffset" />int QTableView.horizontalOffset (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#horizontalOffset">QAbstractItemView.horizontalOffset</a>().</p>
<p>Returns the horizontal offset of the items in the table
view.</p>
<p>Note that the table view uses the horizontal header section
positions to determine the positions of columns in the view.</p>
<p><b>See also</b> <a href="qtableview.html#verticalOffset">verticalOffset</a>().</p>


<h3 class="fn"><a name="horizontalScrollbarAction" />QTableView.horizontalScrollbarAction (<i>self</i>, int&#160;<i>action</i>)</h3><h3 class="fn"><a name="indexAt" /><a href="qmodelindex.html">QModelIndex</a> QTableView.indexAt (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#indexAt">QAbstractItemView.indexAt</a>().</p>
<p>Returns the index position of the model item corresponding to
the table item at position <i>pos</i> in contents coordinates.</p>


<h3 class="fn"><a name="isColumnHidden" />bool QTableView.isColumnHidden (<i>self</i>, int&#160;<i>column</i>)</h3><p>Returns true if the given <i>column</i> is hidden; otherwise
returns false.</p>
<p><b>See also</b> <a href="qtableview.html#isRowHidden">isRowHidden</a>().</p>


<h3 class="fn"><a name="isCornerButtonEnabled" />bool QTableView.isCornerButtonEnabled (<i>self</i>)</h3><h3 class="fn"><a name="isIndexHidden" />bool QTableView.isIndexHidden (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#isIndexHidden">QAbstractItemView.isIndexHidden</a>().</p>


<h3 class="fn"><a name="isRowHidden" />bool QTableView.isRowHidden (<i>self</i>, int&#160;<i>row</i>)</h3><p>Returns true if the given <i>row</i> is hidden; otherwise
returns false.</p>
<p><b>See also</b> <a href="qtableview.html#isColumnHidden">isColumnHidden</a>().</p>


<h3 class="fn"><a name="isSortingEnabled" />bool QTableView.isSortingEnabled (<i>self</i>)</h3><h3 class="fn"><a name="moveCursor" /><a href="qmodelindex.html">QModelIndex</a> QTableView.moveCursor (<i>self</i>, <a href="qabstractitemview.html#CursorAction-enum">QAbstractItemView.CursorAction</a>&#160;<i>cursorAction</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifiers</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#moveCursor">QAbstractItemView.moveCursor</a>().</p>
<p>Moves the cursor in accordance with the given
<i>cursorAction</i>, using the information provided by the
<i>modifiers</i>.</p>
<p><b>See also</b> <a href="qabstractitemview.html#CursorAction-enum">QAbstractItemView.CursorAction</a>.</p>


<h3 class="fn"><a name="paintEvent" />QTableView.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>
<p>Paints the table on receipt of the given paint event
<i>event</i>.</p>


<h3 class="fn"><a name="resizeColumnsToContents" />QTableView.resizeColumnsToContents (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void resizeColumnsToContents()</tt>.</p><p>Resizes all columns based on the size hints of the delegate used
to render each item in the columns.</p>


<h3 class="fn"><a name="resizeColumnToContents" />QTableView.resizeColumnToContents (<i>self</i>, int&#160;<i>column</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void resizeColumnToContents(int)</tt>.</p><p>Resizes the given <i>column</i> based on the size hints of the
delegate used to render each item in the column.</p>
<p><b>Note:</b> Only visible columns will be resized. Reimplement
<a href="qtableview.html#sizeHintForColumn">sizeHintForColumn</a>()
to resize hidden columns as well.</p>


<h3 class="fn"><a name="resizeRowsToContents" />QTableView.resizeRowsToContents (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void resizeRowsToContents()</tt>.</p><p>Resizes all rows based on the size hints of the delegate used to
render each item in the rows.</p>


<h3 class="fn"><a name="resizeRowToContents" />QTableView.resizeRowToContents (<i>self</i>, int&#160;<i>row</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void resizeRowToContents(int)</tt>.</p><p>Resizes the given <i>row</i> based on the size hints of the
delegate used to render each item in the row.</p>


<h3 class="fn"><a name="rowAt" />int QTableView.rowAt (<i>self</i>, int&#160;<i>y</i>)</h3><p>Returns the row in which the given y-coordinate, <i>y</i>, in
contents coordinates is located.</p>
<p><b>Note:</b> This function returns -1 if the given coordinate is
not valid (has no row).</p>
<p><b>See also</b> <a href="qtableview.html#columnAt">columnAt</a>().</p>


<h3 class="fn"><a name="rowCountChanged" />QTableView.rowCountChanged (<i>self</i>, int&#160;<i>oldCount</i>, int&#160;<i>newCount</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void rowCountChanged(int,int)</tt>.</p><p>This slot is called whenever rows are added or deleted. The
previous number of rows is specified by <i>oldCount</i>, and the
new number of rows is specified by <i>newCount</i>.</p>


<h3 class="fn"><a name="rowHeight" />int QTableView.rowHeight (<i>self</i>, int&#160;<i>row</i>)</h3><p>Returns the height of the given <i>row</i>.</p>
<p><b>See also</b> <a href="qtableview.html#setRowHeight">setRowHeight</a>(), <a href="qtableview.html#resizeRowToContents">resizeRowToContents</a>(),
and <a href="qtableview.html#columnWidth">columnWidth</a>().</p>


<h3 class="fn"><a name="rowMoved" />QTableView.rowMoved (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>oldIndex</i>, int&#160;<i>newIndex</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void rowMoved(int,int,int)</tt>.</p><p>This slot is called to change the index of the given <i>row</i>
in the table view. The old index is specified by <i>oldIndex</i>,
and the new index by <i>newIndex</i>.</p>
<p><b>See also</b> <a href="qtableview.html#columnMoved">columnMoved</a>().</p>


<h3 class="fn"><a name="rowResized" />QTableView.rowResized (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>oldHeight</i>, int&#160;<i>newHeight</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void rowResized(int,int,int)</tt>.</p><p>This slot is called to change the height of the given
<i>row</i>. The old height is specified by <i>oldHeight</i>, and
the new height by <i>newHeight</i>.</p>
<p><b>See also</b> <a href="qtableview.html#columnResized">columnResized</a>().</p>


<h3 class="fn"><a name="rowSpan" />int QTableView.rowSpan (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>column</i>)</h3><p>Returns the row span of the table element at (<i>row</i>,
<i>column</i>). The default is 1.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qtableview.html#setSpan">setSpan</a>()
and <a href="qtableview.html#columnSpan">columnSpan</a>().</p>


<h3 class="fn"><a name="rowViewportPosition" />int QTableView.rowViewportPosition (<i>self</i>, int&#160;<i>row</i>)</h3><p>Returns the y-coordinate in contents coordinates of the given
<i>row</i>.</p>


<h3 class="fn"><a name="scrollContentsBy" />QTableView.scrollContentsBy (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</h3><h3 class="fn"><a name="scrollTo" />QTableView.scrollTo (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>, <a href="qabstractitemview.html#ScrollHint-enum">QAbstractItemView.ScrollHint</a>&#160;<i>hint</i>&#160;=&#160;QAbstractItemView.EnsureVisible)</h3><h3 class="fn"><a name="selectColumn" />QTableView.selectColumn (<i>self</i>, int&#160;<i>column</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void selectColumn(int)</tt>.</p><p>Selects the given <i>column</i> in the table view if the current
<a href="qabstractitemview.html#SelectionMode-enum">SelectionMode</a> and
<a href="qabstractitemview.html#SelectionBehavior-enum">SelectionBehavior</a>
allows columns to be selected.</p>
<p><b>See also</b> <a href="qtableview.html#selectRow">selectRow</a>().</p>


<h3 class="fn"><a name="selectedIndexes" />list-of-QModelIndex QTableView.selectedIndexes (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#selectedIndexes">QAbstractItemView.selectedIndexes</a>().</p>


<h3 class="fn"><a name="selectionChanged" />QTableView.selectionChanged (<i>self</i>, <a href="qitemselection.html">QItemSelection</a>&#160;<i>selected</i>, <a href="qitemselection.html">QItemSelection</a>&#160;<i>deselected</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#selectionChanged">QAbstractItemView.selectionChanged</a>().</p>


<h3 class="fn"><a name="selectRow" />QTableView.selectRow (<i>self</i>, int&#160;<i>row</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void selectRow(int)</tt>.</p><p>Selects the given <i>row</i> in the table view if the current
<a href="qabstractitemview.html#SelectionMode-enum">SelectionMode</a> and
<a href="qabstractitemview.html#SelectionBehavior-enum">SelectionBehavior</a>
allows rows to be selected.</p>
<p><b>See also</b> <a href="qtableview.html#selectColumn">selectColumn</a>().</p>


<h3 class="fn"><a name="setColumnHidden" />QTableView.setColumnHidden (<i>self</i>, int&#160;<i>column</i>, bool&#160;<i>hide</i>)</h3><p>If <i>hide</i> is true the given <i>column</i> will be hidden;
otherwise it will be shown.</p>
<p><b>See also</b> <a href="qtableview.html#isColumnHidden">isColumnHidden</a>() and <a href="qtableview.html#setRowHidden">setRowHidden</a>().</p>


<h3 class="fn"><a name="setColumnWidth" />QTableView.setColumnWidth (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>width</i>)</h3><p>Sets the width of the given <i>column</i> to be
<i>width</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qtableview.html#columnWidth">columnWidth</a>().</p>


<h3 class="fn"><a name="setCornerButtonEnabled" />QTableView.setCornerButtonEnabled (<i>self</i>, bool&#160;<i>enable</i>)</h3><h3 class="fn"><a name="setGridStyle" />QTableView.setGridStyle (<i>self</i>, <a href="qt.html#PenStyle-enum">Qt.PenStyle</a>&#160;<i>style</i>)</h3><h3 class="fn"><a name="setHorizontalHeader" />QTableView.setHorizontalHeader (<i>self</i>, <a href="qheaderview.html">QHeaderView</a>&#160;<i>header</i>)</h3><p>The <i>header</i> argument has it's ownership transferred to Qt.</p><p>Sets the widget to use for the horizontal header to
<i>header</i>.</p>
<p><b>See also</b> <a href="qtableview.html#horizontalHeader">horizontalHeader</a>() and
<a href="qtableview.html#setVerticalHeader">setVerticalHeader</a>().</p>


<h3 class="fn"><a name="setModel" />QTableView.setModel (<i>self</i>, <a href="qabstractitemmodel.html">QAbstractItemModel</a>&#160;<i>model</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#setModel">QAbstractItemView.setModel</a>().</p>


<h3 class="fn"><a name="setRootIndex" />QTableView.setRootIndex (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#setRootIndex">QAbstractItemView.setRootIndex</a>().</p>


<h3 class="fn"><a name="setRowHeight" />QTableView.setRowHeight (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>height</i>)</h3><p>Sets the height of the given <i>row</i> to be <i>height</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qtableview.html#rowHeight">rowHeight</a>().</p>


<h3 class="fn"><a name="setRowHidden" />QTableView.setRowHidden (<i>self</i>, int&#160;<i>row</i>, bool&#160;<i>hide</i>)</h3><p>If <i>hide</i> is true <i>row</i> will be hidden, otherwise it
will be shown.</p>
<p><b>See also</b> <a href="qtableview.html#isRowHidden">isRowHidden</a>() and <a href="qtableview.html#setColumnHidden">setColumnHidden</a>().</p>


<h3 class="fn"><a name="setSelection" />QTableView.setSelection (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>, <a href="qitemselectionmodel-selectionflags.html">QItemSelectionModel.SelectionFlags</a>&#160;<i>command</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#setSelection">QAbstractItemView.setSelection</a>().</p>
<p>Selects the items within the given <i>rect</i> and in accordance
with the specified selection <i>flags</i>.</p>


<h3 class="fn"><a name="setSelectionModel" />QTableView.setSelectionModel (<i>self</i>, <a href="qitemselectionmodel.html">QItemSelectionModel</a>&#160;<i>selectionModel</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#setSelectionModel">QAbstractItemView.setSelectionModel</a>().</p>


<h3 class="fn"><a name="setShowGrid" />QTableView.setShowGrid (<i>self</i>, bool&#160;<i>show</i>)</h3><h3 class="fn"><a name="setSortingEnabled" />QTableView.setSortingEnabled (<i>self</i>, bool&#160;<i>enable</i>)</h3><h3 class="fn"><a name="setSpan" />QTableView.setSpan (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, int&#160;<i>rowSpan</i>, int&#160;<i>columnSpan</i>)</h3><p>Sets the span of the table element at (<i>row</i>,
<i>column</i>) to the number of rows and columns specified by
(<i>rowSpanCount</i>, <i>columnSpanCount</i>).</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qtableview.html#rowSpan">rowSpan</a>()
and <a href="qtableview.html#columnSpan">columnSpan</a>().</p>


<h3 class="fn"><a name="setVerticalHeader" />QTableView.setVerticalHeader (<i>self</i>, <a href="qheaderview.html">QHeaderView</a>&#160;<i>header</i>)</h3><p>The <i>header</i> argument has it's ownership transferred to Qt.</p><p>Sets the widget to use for the vertical header to
<i>header</i>.</p>
<p><b>See also</b> <a href="qtableview.html#verticalHeader">verticalHeader</a>() and <a href="qtableview.html#setHorizontalHeader">setHorizontalHeader</a>().</p>


<h3 class="fn"><a name="setWordWrap" />QTableView.setWordWrap (<i>self</i>, bool&#160;<i>on</i>)</h3><h3 class="fn"><a name="showColumn" />QTableView.showColumn (<i>self</i>, int&#160;<i>column</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void showColumn(int)</tt>.</p><p>Show the given <i>column</i>.</p>
<p><b>See also</b> <a href="qtableview.html#hideColumn">hideColumn</a>() and <a href="qtableview.html#showRow">showRow</a>().</p>


<h3 class="fn"><a name="showGrid" />bool QTableView.showGrid (<i>self</i>)</h3><h3 class="fn"><a name="showRow" />QTableView.showRow (<i>self</i>, int&#160;<i>row</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void showRow(int)</tt>.</p><p>Show the given <i>row</i>.</p>
<p><b>See also</b> <a href="qtableview.html#hideRow">hideRow</a>()
and <a href="qtableview.html#showColumn">showColumn</a>().</p>


<h3 class="fn"><a name="sizeHintForColumn" />int QTableView.sizeHintForColumn (<i>self</i>, int&#160;<i>column</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#sizeHintForColumn">QAbstractItemView.sizeHintForColumn</a>().</p>
<p>Returns the size hint for the given <i>column</i>'s width or -1
if there is no model.</p>
<p>If you need to set the width of a given column to a fixed value,
call <a href="qheaderview.html#resizeSection">QHeaderView.resizeSection</a>()
on the table's horizontal header.</p>
<p>If you reimplement this function in a subclass, note that the
value you return will be used when <a href="qtableview.html#resizeColumnToContents">resizeColumnToContents</a>()
or <a href="qheaderview.html#resizeSections">QHeaderView.resizeSections</a>()
is called. If a larger column width is required by either the
horizontal header or the item delegate, the larger width will be
used instead.</p>
<p><b>See also</b> <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a> and <a href="qtableview.html#horizontalHeader">horizontalHeader</a>().</p>


<h3 class="fn"><a name="sizeHintForRow" />int QTableView.sizeHintForRow (<i>self</i>, int&#160;<i>row</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#sizeHintForRow">QAbstractItemView.sizeHintForRow</a>().</p>
<p>Returns the size hint for the given <i>row</i>'s height or -1 if
there is no model.</p>
<p>If you need to set the height of a given row to a fixed value,
call <a href="qheaderview.html#resizeSection">QHeaderView.resizeSection</a>()
on the table's vertical header.</p>
<p>If you reimplement this function in a subclass, note that the
value you return is only used when <a href="qtableview.html#resizeRowToContents">resizeRowToContents</a>() is
called. In that case, if a larger row height is required by either
the vertical header or the item delegate, that width will be used
instead.</p>
<p><b>See also</b> <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a> and <a href="qtableview.html#verticalHeader">verticalHeader</a>().</p>


<h3 class="fn"><a name="sortByColumn" />QTableView.sortByColumn (<i>self</i>, int&#160;<i>column</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void sortByColumn(int)</tt>.</p><p>Sorts the model by the values in the given <i>column</i> in the
given <i>order</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qtableview.html#sortingEnabled-prop">sortingEnabled</a>.</p>


<h3 class="fn"><a name="sortByColumn-2" />QTableView.sortByColumn (<i>self</i>, int&#160;<i>column</i>, <a href="qt.html#SortOrder-enum">Qt.SortOrder</a>&#160;<i>order</i>)</h3><h3 class="fn"><a name="timerEvent" />QTableView.timerEvent (<i>self</i>, <a href="qtimerevent.html">QTimerEvent</a>&#160;<i>event</i>)</h3><p>Reimplemented from <a href="qobject.html#timerEvent">QObject.timerEvent</a>().</p>


<h3 class="fn"><a name="updateGeometries" />QTableView.updateGeometries (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#updateGeometries">QAbstractItemView.updateGeometries</a>().</p>


<h3 class="fn"><a name="verticalHeader" /><a href="qheaderview.html">QHeaderView</a> QTableView.verticalHeader (<i>self</i>)</h3><p>Returns the table view's vertical header.</p>
<p><b>See also</b> <a href="qtableview.html#setVerticalHeader">setVerticalHeader</a>(),
<a href="qtableview.html#horizontalHeader">horizontalHeader</a>(),
and <a href="qabstractitemmodel.html#headerData">QAbstractItemModel.headerData</a>().</p>


<h3 class="fn"><a name="verticalOffset" />int QTableView.verticalOffset (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#verticalOffset">QAbstractItemView.verticalOffset</a>().</p>
<p>Returns the vertical offset of the items in the table view.</p>
<p>Note that the table view uses the vertical header section
positions to determine the positions of rows in the view.</p>
<p><b>See also</b> <a href="qtableview.html#horizontalOffset">horizontalOffset</a>().</p>


<h3 class="fn"><a name="verticalScrollbarAction" />QTableView.verticalScrollbarAction (<i>self</i>, int&#160;<i>action</i>)</h3><h3 class="fn"><a name="viewOptions" /><a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> QTableView.viewOptions (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemview.html#viewOptions">QAbstractItemView.viewOptions</a>().</p>
<h3 class="fn"><a name="visualRect" /><a href="qrect.html">QRect</a> QTableView.visualRect (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><h3 class="fn"><a name="visualRegionForSelection" /><a href="qregion.html">QRegion</a> QTableView.visualRegionForSelection (<i>self</i>, <a href="qitemselection.html">QItemSelection</a>&#160;<i>selection</i>)</h3><h3 class="fn"><a name="wordWrap" />bool QTableView.wordWrap (<i>self</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>